/*
 * Course:    CS 590 Web Services
 * Semseter:  Spring 2009
 * Professor: Sedlemeyer
 * Project:   CHEAT (Code Help Educational Assignment Tool)
 * Due Date:  May 1, 2009
 * Team:      Sarcasm
 *            (Baker, Jason; Mitchell, Robin; Shie, Keith)
 */

package cheat.administration;

import java.io.Serializable;
import java.util.Date;


/**
 * Container for Repository statistics.
 *
 *
 * @author Keith Shie
 */
public class RepositoryStatistics implements Serializable {
  private long assignmentCount;
  private long deletedAssignmentCount;
  private long userCount;
  private long authorCount;
  private Date oldestAssignment;
  private Date newestAssignment;


  /**
   * The number of assignments within the system.
   *
   * @return the number of assignments within the system. <p><i>Does not include assignments which have been deleted.</i></p>
   */
  public long getAssignmentCount() {
    return assignmentCount;
  }


  public void setAssignmentCount( long assignmentCount ) {
    this.assignmentCount = assignmentCount;
  }


  /**
   * The number of persons listed as an author to an assignment.
   *
   * @return The number of persons listed as an author to an assignment.
   */
  public long getAuthorCount() {
    return authorCount;
  }


  public void setAuthorCount( long authorCount ) {
    this.authorCount = authorCount;
  }


  /**
   * The number of assignments within the system which have been deleted.
   *
   * @return the number of assignments within the system which have been deleted.
   */
  public long getDeletedAssignmentCount() {
    return deletedAssignmentCount;
  }


  public void setDeletedAssignmentCount( long deletedAssignmentCount ) {
    this.deletedAssignmentCount = deletedAssignmentCount;
  }


  /**
   * The number of person with access to the system.
   *
   * @return The number of person with access to the system. <p><i>Includes both active and pending users.</i></p>
   */
  public long getUserCount() {
    return userCount;
  }


  public void setUserCount( long userCount ) {
    this.userCount = userCount;
  }


  /**
   * The date of the newest assignment within the system.
   *
   * @return The date of the newest assignment within the system.
   */
  public Date getNewestAssignment() {
    return newestAssignment;
  }


  public void setNewestAssignment( Date newestAssignment ) {
    this.newestAssignment = newestAssignment;
  }


  /**
   * The date of the oldest assignment within the system.
   *
   * @return The date of the oldest assignment within the system.
   */
  public Date getOldestAssignment() {
    return oldestAssignment;
  }


  public void setOldestAssignment( Date oldestAssignment ) {
    this.oldestAssignment = oldestAssignment;
  }


  /**
   * Returns a string representation of this RespoitoryStatistics container.
   *
   * @return a string representation of this RespoitoryStatistics container.
   */
  @Override
  public String toString(){
    StringBuilder sb = new StringBuilder("RepositoryStatistics: [");

    sb.append( "Assignments: " ).append( assignmentCount ).append(  " [").append( deletedAssignmentCount).append( " deleted, ");
    sb.append( "oldest: ").append( oldestAssignment ).append( ", ").append( "newest: ").append( newestAssignment).append( "], ");
    sb.append( "Users: ").append( userCount).append( ", ");
    sb.append( "Authors: ").append( authorCount);

    sb.append( " ]");

    return sb.toString();
  }
}
